package cn.com.mrAdv03;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;

public class MyselfIntWritable implements WritableComparable<MyselfIntWritable> {

	private int number;

	public int getNumber() {
		return number;
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeInt(number);
	}

	@Override
	public void readFields(DataInput in) throws IOException {
		this.number = in.readInt();
	}

	@Override
	public int compareTo(MyselfIntWritable other) {
		int thisValue = this.number;
		int thatValue = other.number;
		return (thisValue < thatValue ? 1 : (thisValue == thatValue ? 0 : -1));
	}

	public void set(int num) {
		this.number = num;
	}
}
